using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OracleClient;

using DQS.EL;

namespace DQS.DAL
{
    public static class DQ_PubDataService
    {
        public static IList<DQ_PUBDATA> GetDataByType(string argType)
        {
            IList<DQ_PUBDATA> _objs = new List<DQ_PUBDATA>();
            string sqlStr = "SELECT Data_Code,Data_Name FROM Dq_PubData WHERE Data_Type=:Data_Type ORDER BY data_order";
            OracleParameter[] _params = { 
                new OracleParameter(":Data_Type",OracleType.VarChar,255)
            };
            _params[0].Value = argType;
            using (OracleDataReader odr = OracleHelper.ExecuteReader(sqlStr, CommandType.Text, _params))
            {
                while (odr.Read())
                {
                    DQ_PUBDATA _obj = new DQ_PUBDATA();
                    _obj.DATA_CODE = odr.GetString(0);
                    _obj.DATA_NAME = odr.GetString(1);
                    _objs.Add(_obj);
                }
            }
            return _objs;
        }
    }
}
